<template>
  <div class="conscard">
    <img :src=" require(`@/assets/img/${store.state.consName}.jpg`)" :alt="store.state.consName">
    <div class="mask">
      <h1>{{store.state.consName}}</h1>
      <h2><span v-if="content">综合指数：{{content||'加载中...'}}</span></h2>
    </div>
  </div>
</template>
<script>
import { useStore } from 'vuex'
export default {
  name: 'constcard',
  props: {
    content: Number
  },
  setup() {
    const store = useStore()
    return {
      store
    }
  }
}
</script>
<style lang="less" scoped>
.conscard {
  position: relative;
  box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.8);
  height: 240px;
  border-radius: 15px;
  margin: 8px 14px 18px;
  overflow: hidden;
  img {
    width: 100%;
    height: 100%;
  }
  .mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.2);
  }
  h1 {
    font-weight: 400;
  }
  h2 {
    font-weight: 400;
    height: 20px;
    line-height: 20px;
    font-size: 18px;
    margin-top: 20px;
  }
}
</style>
